import { Image, View } from "react-native";

import Toast, {
  BaseToast,
  BaseToastProps,
  ErrorToast,
} from "react-native-toast-message";

export const MyToast = () => {
  const toastConfig = {
    success: (props: BaseToastProps) => (
      <BaseToast
        {...props}
        style={{ borderLeftColor: "transparent" }}
        contentContainerStyle={{ paddingHorizontal: 15 }}
        text1Style={{
          fontSize: 17,
          fontWeight: "400",
        }}
        renderLeadingIcon={() => (
          <View
            style={{
              marginLeft: 10,
              width: 40,
              height: 40,
              alignSelf: "center",
            }}
          >
            <Image
              source={require("../../assets/images/icon_logo.png")}
              style={{ width: 40, height: 40 }}
            />
          </View>
        )}
      />
    ),

    error: (props: BaseToastProps) => (
      <ErrorToast
        {...props}
        style={{ borderLeftColor: "red" }}
        text1Style={{
          fontSize: 17,
        }}
        text2Style={{
          fontSize: 15,
        }}
      />
    ),
  };

  return <Toast config={toastConfig} />;
};
